home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / ex / ex13-10.c < prev    next >
C/C++ Source or Header  |  1990-05-15  |  1KB  |  39 lines

  1. // ex13-10.c -- MI and Object I/O readFrom()
  2.  
  3. // $Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/ex/RCS/ex13-10.c,v 3.0 90/05/15 22:44:32 kgorlen Rel $
  4.  
  5. #include <fstream.h>
  6. #include <osfcn.h>
  7. #include "LandVhcl.h"
  8. #include "WaterVhcl.h"
  9. #include "AmphibVhcl.h"
  10. #include "StopLightQ.h"
  11. #include "DrawBridgeQ.h"
  12. #include "OrderedCltn.h"
  13. #include "OIOnih.h"
  14.  
  15. StopLightQ* stopLightQ[2];
  16. DrawBridgeQ* drawBridgeQ;
  17.  
  18. main()
  19. {
  20.     ifstream in("trafficfile");
  21.     if (in.fail()) {
  22.         cerr << "Failed to open trafficfile\n";
  23.         exit(1);
  24.     }
  25.     OrderedCltn& allQueues = *OrderedCltn::readFrom(OIOnihin(in));
  26.     stopLightQ[0] = StopLightQ::castdown(allQueues[1]);
  27.     stopLightQ[1] = StopLightQ::castdown(allQueues[2]);
  28.     drawBridgeQ = DrawBridgeQ::castdown(allQueues[3]);
  29.  
  30.     cout << "allVehicles:\n"; Vehicle::printAll();
  31.     cout << endl;
  32.     cout << "stopLightQ[0]:\n"; stopLightQ[0]->printOn();
  33.     cout << endl;
  34.     cout << "stopLightQ[1]:\n"; stopLightQ[1]->printOn();
  35.     cout << endl;
  36.     cout << "drawBridgeQ:\n"; drawBridgeQ->printOn();
  37.     cout << endl;
  38. }
  39.